<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%String path = request.getContextPath(); %>
<!DOCTYPE html>
<html>
<head>
        <meta charset="UTF-8">
        <title>欢迎页面-admin2.2</title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
      
        <link rel="stylesheet" href="<%=path %>/back/css/font.css">
        <link rel="stylesheet" href="<%=path %>/back/css/xadmin.css">
        <script type="text/javascript" src="<%=path %>/back/lib/layui/layui.js" charset="utf-8"></script>
        <script type="text/javascript" src="<%=path %>/back/js/xadmin.js"></script>
        <script type="text/javascript" src="<%=path%>/back/js/jquery-3.5.1.min.js"></script>
        <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
        <!--[if lt IE 9]>
            <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
            <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
        <![endif]-->
    </head>
<body>
	<style type="text/css">
    	.center{
    	margin-top:100px;
    	}
    	.nie{
    	clear:both;
    	margin:10px 0;
    	}
    	#myform{
    	padding-left:100px;
    	}
    	.niekejie{
    	margin-left:60px;
    	}
    	.usernameRs{
    	clear:both;
    	}
    </style>
        <div id="connect" class="center">
            
				                <form id="myform"  method="post"  action="<%=path%>/SuperServlet?action=addAdmin" class="layui-form">
						                  <div class="layui-form-item">
						                      <label for="username" class="layui-form-label">
						                          <!-- <span class="x-red">*</span> -->账号:
						                      </label>
						                      <div class="layui-input-inline">
						    <!-- 账号 -->       <input type="text" id="checkCookName" name="username"  class="layui-input username">
						                      </div><span class="usernameRs"></span>
						                      <label for="username" class="layui-form-label nie">
						                          <!-- <span class="x-red">*</span> -->密码:
						                      </label>
						                      <div class="layui-input-inline">
							<!-- 密码 -->        <input type="text" id="checkCookPass" name="userpass"  class="layui-input nie userpass">
						                      </div>
						                      <div class="layui-form-mid layui-word-aux">
						                          <!-- <span  class="x-red">*</span>
						                          <span id="checkCookTypeName">将加入口味列表</span> -->
						                          <span class="font"></span>
						                            <%
														String errMes = request.getParameter("errMes");
													%>
													<%
														if("1".equals(errMes))
														{
													%>
															<font style="margin-top:10px;" color="red">账号重复</font>
													<%
														}
													%>
													
													<%
														if("0".equals(errMes))
														{
													%>
															<font class="font" color="red">添加成功</font>
													<%
														}
													%>
						                          
						                      </div>
						                  </div>					
						                  <div class="layui-form-item">
						                      <label for="L_repass" class="layui-form-label">
						                      </label>
						    <!-- 添加 -->         <input id="button" type="submit" value="添加"   class="layui-btn niekejie " >        
						                  </div>
				              </form>
	      </div>
</body>
</html>

<script type="text/javascript">
   //管理员添加管理员账号的时候的事件
	$(function(){
	$(".username").blur(checkname);
});
function checkname(){
	var userpass=$(".username").val();
	var reg=/^\w{5,15}$/;
	var flag=reg.test(userpass);
	if(flag){
		//$(".usernameRs").html("√");
		//$(".usernameRs").css("color","green");
		return true;
	}
	else{
		//$(".usernameRs").html("x");
		//$(".usernameRs").css("color","red");
		return false;
	}
}
</script>
<script>
	//管理添加管理员密码的时候的事件
	$(function(){
	$(".userpass").blur(checkpass);
});
function checkpass(){
	var userpass=$(".userpass").val();
	var reg=/^\w{5,15}$/;
	var flag=reg.test(userpass);
	if(flag){
		//$("#userpassRs").html("&#xe623;");
		//$("#userpassRs").css("color","green");
		return true;
	}
	else{
		//$("#userpassRs").html("x");
		//$("#userpassRs").css("color","red");
		return false;
	}
}
</script>
<script type="text/javascript">
$(function(){
	$("#myform").submit(check);
});
function check(){
	//调用 验证的方法们
	var f1=checkname();
	var f2=checkpass();
	$(".usernameRs").html("用户名或密码格式不正确");
	$(".usernameRs").css("color","red");
	return f1&&f2;
};
</script>

